<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>3_数据类型</title>
</head>
<body>
<script>
    var a = 1;
    var b = 2.23;
    console.log(a,typeof a,b,typeof b);//整数小数都是number类型
    var c = "hello world";
    var d = 'ddd';
    console.log(c,typeof c);//字符串都是string类型
    var e = true;
    var f = false;
    console.log(e,typeof e,f,typeof f);//布尔类型
    var g ;
    console.log(g,typeof g);//声明了变量但是未赋值,得到undefined未定义型
    //引用类型 Object
    let obj = {
        name:"张三",
        age:18
    };
    console.log(obj,typeof obj);//{name:'张三',age:18}
    console.log(obj.name);//张三
    console.log(obj.age);//18
    // 动态设置新属性
    obj.like = "java";
    console.log(obj);//{name:'张三',age:18,like:'java'}
    console.log(obj.like);//java
    console.log(obj.play)//undefined

    let arr = ['李逵',1,2,3,false];
    console.log(arr,typeof arr);//['李逵',1,2,3,false]
    console.log(arr[0]);//李逵
    console.log(arr[1]);//1
    console.log(arr[99]);//undefined
</script>
</script>

</body>
</html>